class Solution:
    def rotate(self, nums: list, k: int) -> None:
        """
        Do not return anything, modify nums in-place instead.
        """
        while k > len(nums):
            k -= len(nums)
        mid_nums = nums[-k:] + nums[:-k]
        # for i in range(len(nums)):
        #     nums[i] = mid_nums[i]
        nums.clear()
        nums.extend(mid_nums)


a = Solution()
b = [1, 2, 3, 4, 5, 6, 7]
a.rotate(b, 3)
print(b)
b = [-1, -100, 3, 99]
a.rotate(b, 2)
print(b)
